package com.yami.shop.app.controller;

import com.yami.shop.app.utils.HttpResult;
import com.yami.shop.bean.model.ShopDetail;
import com.yami.shop.security.util.SecurityUtils;
import com.yami.shop.service.ShopDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.yami.shop.service.AppCashRegisterSystemUserService;
import com.yami.shop.bean.cashregisterapp.AppCashRegisterSystemUser;

@Controller
@RequestMapping("/app/appShopDetail")
public class AppShopDetailController {

    @Autowired
    private ShopDetailService shopDetailService;

    @Autowired
    private AppCashRegisterSystemUserService appCashRegisterSystemUserService;

    /**
     * 获取店铺信息详情
     */
    @PostMapping("/info")
    @ResponseBody
    public HttpResult info(){
        ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(SecurityUtils.getSysUser().getShopId());
        AppCashRegisterSystemUser appCashRegisterSystemUser = appCashRegisterSystemUserService.getById(SecurityUtils.getSysUser().getUserId());
        shopDetail.setAppCashRegisterSystemUser(appCashRegisterSystemUser);
        return HttpResult.success(shopDetail);
    }
}
